package org.eenie.commonlib.ui.win;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.view.View;

import com.eenie.common.base.BaseActivity;
import com.eenie.common.base.WinMode;

import org.eenie.commonlib.R;
import org.eenie.commonlib.databinding.ActivityWinModeShowBinding;
import org.jetbrains.annotations.NotNull;

public class WinModeShowActivity extends BaseActivity {
    String mWinModeDesc = "正常模式";
    ActivityWinModeShowBinding mBinding;

    @Override
    public int initContentView() {
        return R.layout.activity_win_mode_show;
    }

    @Override
    public void initInjector() {
        switch (getIntent().getIntExtra("win_mode", 0)) {
            case 0:
                setWinMode(WinMode.NORMAL);
                mWinModeDesc = "正常模式";
                break;
            case 1:
                setWinMode(WinMode.IMMERSE);
                mWinModeDesc = "沉浸模式";
                break;
            case 2:
                setWinMode(WinMode.FULL);
                mWinModeDesc = "全屏模式";
                break;
        }


    }

    @Override
    public void initUiAndListener(@NotNull View view) {
        mBinding = ActivityWinModeShowBinding.bind(view);
        mBinding.tvMode.setText(String.format("当前窗口模式：%s", mWinModeDesc));
    }


    @SuppressLint("NonConstantResourceId")
    public void onViewClicked(View view) {
        int mode = 0;
        switch (view.getId()) {
            case R.id.btn_normal:
                setWinMode(WinMode.NORMAL);
                mode = 0;
                break;
            case R.id.btn_immerse:
                setWinMode(WinMode.IMMERSE);
                mode = 1;
                break;
            case R.id.btn_full:
                setWinMode(WinMode.FULL);
                mode = 2;
                break;
        }

        startActivity(new Intent(mContext, WinModeShowActivity.class)
                .putExtra("win_mode", mode));
        finish();
        overridePendingTransition(0, 0);

    }


}
